Skip to content

fix(circom): reuse compressed public key in V1 challenge - #153

Open
wj00243-lgtm wants to merge 1 commit into
plume-sig:mainfrom
wj00243-lgtm:reuse-v1-compressed-pk
Open

wj00243-lgtm wants to merge 1 commit into
plume-sig:mainfrom
wj00243-lgtm:reuse-v1-compressed-pk

Conversation

@wj00243-lgtm

Copy link
Copy Markdown

Fixes #14

Problem

The V1 circuit compressed the public key twice: once for the hash-to-curve preimage and once again while building the V1 challenge hash preimage.

Solution

This exposes the already computed compressed public key from check_ec_equations and reuses it in the V1 challenge SHA-256 helper. The challenge preimage bytes stay the same, but the circuit avoids a duplicate public-key compression component.

Tests

  • Added a focused v1_challenge_sha_256_test.circom test circuit.
  • Extended sha256Circuit.test.ts to verify the V1 challenge hash accepts the reused compressed public key bytes and still matches the existing digest.
  • Ran git diff --check.

I could not run the full local circuit suite in this environment because pnpm install fails while fetching https://gitpkg.now.sh/geometryresearch/secp256k1_hash_to_curve/circuits?main with HTTP 402. The local Node version is also v24.15.0 while this package declares >=16 <19.

@wj00243-lgtm
wj00243-lgtm marked this pull request as ready for review May 20, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public key compressed twice

2 participants